
Imports System
Imports System.Data.SqlClient

Namespace _2bMatesSite.BO
	''' <summary>
	''' Summary description for GroupComment.
	''' </summary>
	Public Class GroupComment
		Protected commentID As Integer
		Protected groupID As Integer
		Protected fromUserID As Integer
		Protected comment As String
		Protected status As Status
		Protected [date] As DateTime

		Public Enum Status
			ucsNew = 0
			ucsAccepted = 1
		End Enum

		Public Sub New(ByVal groupID As Integer, ByVal fromUserID As Integer, ByVal comment As String)
			commentID = -1
			Me.groupID = groupID
			Me.fromUserID = fromUserID
			Me.comment = comment
			status = Status.ucsNew
			[date] = DateTime.Now
		End Sub

		Public Sub New(ByVal dr As SqlDataReader)
			commentID = dr.GetInt32(dr.GetOrdinal("ID"))
			comment = dr.GetString(dr.GetOrdinal("Comment"))
			groupID = dr.GetInt32(dr.GetOrdinal("AboutGroupID"))
			fromUserID = dr.GetInt32(dr.GetOrdinal("PostedByUID"))
			status = DirectCast(dr.GetInt32(dr.GetOrdinal("Status")), Status)
			[date] = dr.GetDateTime(dr.GetOrdinal("Date"))
		End Sub

		Public ReadOnly Property ID() As Integer
			Get
				Return commentID
			End Get
		End Property

		Public ReadOnly Property AboutGroupID() As Integer
			Get
				Return groupID
			End Get
		End Property

		Public ReadOnly Property PostedByUserID() As Integer
			Get
				Return fromUserID
			End Get
		End Property

		Public ReadOnly Property Comment() As String
			Get
				Return comment
			End Get
		End Property

		Public Property CommentStatus() As Status
			Get
				Return status
			End Get
			Set
				status = value
			End Set
		End Property

		Public ReadOnly Property [Date]() As DateTime
			Get
				Return [date]
			End Get
		End Property
	End Class
End Namespace






